package com.zf.shuashua.ui.mine;

import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

import com.vise.xsnow.http.callback.ACallback;
import com.vise.xsnow.http.mode.CacheResult;
import com.zf.shuashua.api.HttpData;
import com.zf.shuashua.bean.FansList;
import com.zf.shuashua.bean.Me;

public class FriedsDetailsVM extends ViewModel {

    private MutableLiveData<Me> refresh;
    private MutableLiveData<Me> more;

    public FriedsDetailsVM() {
    }

    MutableLiveData<Me> getRefresh() {
        if (refresh == null) {
            refresh = new MutableLiveData<>();
        }
        return refresh;
    }


    MutableLiveData<Me> getMore() {
        if (more == null) {
            more = new MutableLiveData<>();
        }
        return more;
    }


    public void getDataRefresh(String user_id) {
        HttpData.getInstance().getUserInfo(user_id, new ACallback<Me>() {
            @Override
            public void onSuccess(Me data) {
                if (data.isStatus() && data.getData() != null) {
                    getRefresh().setValue(data);
                }
            }

            @Override
            public void onFail(int errCode, String errMsg) {
                LogUtil.d(errMsg);

            }
        });
    }


    public void getDataMore(String user_id) {
        HttpData.getInstance().getUserInfo(user_id, new ACallback<Me>() {
            @Override
            public void onSuccess(Me data) {
                if (data.isStatus()) {
                    getRefresh().setValue(data);
                }
            }

            @Override
            public void onFail(int errCode, String errMsg) {
                LogUtil.d(errMsg);

            }
        });
    }


}